home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume3 / laserjet / part1 next >
Encoding:
Internet Message Format  |  1986-11-30  |  13.5 KB

  1. From: genrad!linus!philabs!ron1!ron (Ron Saad)
  2. Subject: HP LaserJet driver part 1 of 2
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 3, Issue 18
  7. Submitted by: philabs!ron1!ron (Ron Saad)
  8.  
  9.  
  10. Enclosed is the shar format source for a ditroff driver that I implemented
  11. for the HP LaserJet.
  12.  
  13.                                   Ron Saad  (4Z4UY) Sys Adm -
  14.                                   Center for Advanced Technology
  15.                                   in Telecommunications
  16.                                   Polytechnic Institute of New York
  17.  
  18. UUCP:   ...{ihnp4,seismo}!{philabs,cmcl2}!ron1!ron
  19. MAIL:   333 Jay St.  Brooklyn, N.Y. 11201
  20. PHONE:  (718) 643-7303
  21.  
  22. #! /bin/sh
  23. # This is a shell archive, meaning:
  24. # 1. Remove everything above the #! /bin/sh line.
  25. # 2. Save the resulting text in a file.
  26. # 3. Execute the file with /bin/sh (not csh) to create the files:
  27. #    README
  28. #    asctab.h
  29. #    glyph.h
  30. #    spectab.h
  31. # This archive created: Mon Sep 23 23:09:20 1985
  32. export PATH; PATH=/bin:$PATH
  33. echo shar: extracting "'README'" '(3528 characters)'
  34. if test -f 'README'
  35. then
  36.     echo shar: will not over-write existing file "'README'"
  37. else
  38. sed 's/^    X//' << \SHAR_EOF > 'README'
  39.     XFollowing is a driver (filter, postprocessor?) for getting ditroff
  40.     Xoutput on the HP LaserJet printer. It is by no means a finished
  41.     Xproduct. It still needs a lot of work, partly for cleanup and partly
  42.     Xfor making it really usable.
  43.     X
  44.     XThe major drawback of the filter is that the output is GIGANTIC,
  45.     Xbecause it issues positioning commands for EVERY character. This also
  46.     Xmakes the printing EXTREMELY SLOW.  (but don't get discouraged, it's
  47.     Xstill usable ...)
  48.     X
  49.     XThe only fix to that problem is to use the LaserJet's default spacing
  50.     Xfor characters, and add width tables for troff to handle the different
  51.     Xspacings of the LaserJet. This has the advantage of reducing the output
  52.     Xsize considerably, along with the time required to print it, BUT - you
  53.     Xalso have to settle for the LaserJet's spacing, which is rather wide
  54.     Xand unattractive (*my opinion*).  Also, the width tables I have don't
  55.     Xagree TOO well with vfont - they expect the Sys 5 stuff - so that could
  56.     Xuse some work too.
  57.     X
  58.     XThe 'draw' functions are not implemented in this filter. I was too lazy
  59.     Xto add them since it's a bit of work and I am not using pic for
  60.     Xanything right now, but if you have the 'draw.c' file that came with
  61.     XDWB (or maybe the equivalent from Berkeley, which I don't have) than
  62.     Xyou can do this yourself.
  63.     X
  64.     XThe fonts in rasti10 look nicer than the ones in vfont.  However, the
  65.     Xglyphs are placed in different positions in the font file, so they need
  66.     Xcode tables to drive them. I never got around to adding the code
  67.     Xtables, but if I do I'll make them available.
  68.     X
  69.     XThere is a 'bug' that I haven't fixed yet - the Laserjet barfs on long
  70.     Xpages. It will not take a positioning command to go to vertical 7600,
  71.     Xfor example, even though it's less than 11 inches. I haven't had enough
  72.     Xtime to look into this and find out exactly how much it WILL let me
  73.     Xuse, but instead I massage all my input files to use a page length
  74.     Xof 10 inches ...
  75.     XThis should not be hard to fix, and if you do, let me know about it.
  76.     X
  77.     XMany people asked for the ^S/^Q filter. I have received many responses
  78.     Xtelling me that this can be achieved via the LITOUT bit, and as many
  79.     Xtelling me that it can't be achieved through LITOUT because of a bug in
  80.     Xthe device driver. I have also received a few versions of fixes for
  81.     Xthis problem. I am therefore leaving out this problem, as it seems to
  82.     Xhave been dealt with extensively. If anybody REALLY wants it, drop me a
  83.     Xline and I'll mail it to you (along with all the other proposed
  84.     Xsolutions I received).
  85.     X
  86.     XFinally, I have lost my HP LaserJet to an AT&T 6300 in an adjacent
  87.     Xoffice. Rumors are we are getting an X2700 (II), but financial
  88.     Xdecisions have not been completed yet. Therefore it seems that
  89.     Xenhancements to this filter will not be top priority in the near future
  90.     X(anybody want to donate a LaserJet to an educational institute ? :-)
  91.     X
  92.     XIf you wish to add the width tables yourself, the information is
  93.     Xavailable from Hewlet Packard. Just call them.  If you need any info
  94.     Xfrom me, feel free to contact  me either through the net (uucp address
  95.     Xbelow) or through the phone...
  96.     X
  97.     XAnd just one thing. If you do make modifications/enhancements/etc,
  98.     XPLEASE let me know? send over whatever you have so that we could share
  99.     Xit with the rest of the net?
  100.     X
  101.     X------------the opinions expressed above etc. etc.  --------------
  102.     X
  103.     X                    Ron Saad  (4Z4UY) Sys Adm -
  104.     X                    Center for Advanced Technology
  105.     X                    in Telecommunications
  106.     X                    Polytechnic Institute of New York
  107.     X
  108.     XUUCP:   ...{ihnp4,seismo}!{philabs,cmcl2}!ron1!ron
  109.     XMAIL:   333 Jay St.  Brooklyn, N.Y. 11201
  110.     XPHONE:  (718) 643-7303
  111. SHAR_EOF
  112. if test 3528 -ne "`wc -c < 'README'`"
  113. then
  114.     echo shar: error transmitting "'README'" '(should have been 3528 characters)'
  115. fi
  116. fi # end of overwriting check
  117. echo shar: extracting "'asctab.h'" '(1440 characters)'
  118. if test -f 'asctab.h'
  119. then
  120.     echo shar: will not over-write existing file "'asctab.h'"
  121. else
  122. sed 's/^    X//' << \SHAR_EOF > 'asctab.h'
  123.     X/*
  124.     X * $Header: asctab.h,v 1.1 85/08/15 14:55:33 ron Exp $
  125.     X */
  126.     X
  127.     X/*
  128.     X * asctab.h - Copyright (c) 1985 by Ron Saad
  129.     X *
  130.     X * This code may be freely distributed in source
  131.     X * for non commercial purposes.
  132.     X * Please keep this notice intact.
  133.     X */
  134.     X
  135.     X/*
  136.     X * $Log:    asctab.h,v $
  137.     X * Revision 1.1  85/08/15  14:55:33  ron
  138.     X * Initial revision
  139.     X * 
  140.     X * 
  141.     X */
  142.     X
  143.     Xchar *asctab[] ={
  144.     X    /*
  145.     X     * these should be things that are "easy"
  146.     X     * to generate with esc seq and the
  147.     X     *  cartridge data, not needing a raster map,
  148.     X     *  plus things that are not available on the
  149.     X     *  special font in raster form
  150.     X     */
  151.     X    "\\|", "\033&a+12H", /* 1/6 em space ?? */
  152.     X    "\\^", "\033&a+36H", /* 1/2 em space ?? */
  153.     X    "em", "-", /* FIX THIS TO DO 3/4 EM */
  154.     X    "hy", "-",
  155.     X    "\\-", "\033&a+30H-",    /* curr fnt minus - spacing problem */
  156.     X    /* "mi", "\033&a+30H-",    /* SHOULD BE ON SPEC FONT */
  157.     X    "ce", "\277",
  158.     X        /* does not work - maybe because we have
  159.     X         * the B cartridge instead of the F one
  160.     X         */
  161.     X    "dg", "|\033&a-30H-",    /* looks lousy - do better */
  162.     X    "aa", "'",
  163.     X    "ga", "`",
  164.     X    "en", "-",
  165.     X    /* "ru", "_", /* use the bit map instead */
  166.     X    "l.", ".",
  167.     X    "br", "|",
  168.     X    "vr", "|",
  169.     X    "fm", "'",
  170.     X    "or", "|",
  171.     X    "fi", "f\033&a-25Hi",    /* fake ligature */
  172.     X    "ff", "f\033&a-25Hf",    /* fake ligature */
  173.     X    "fl", "f\033&a-25Hl",    /* fake ligature */
  174.     X    "Fi", "f\033&a-30Hf\033&a-25Hi",    /* fake ligature */
  175.     X    "Fl", "f\033&a-30Hf\033&a-25Hl",    /* fake ligature */
  176.     X    /* "sl", "\033&a-50H/", /* spacing problem - is on the spec font */
  177.     X    0, 0,
  178.     X};
  179.     X
  180. SHAR_EOF
  181. if test 1440 -ne "`wc -c < 'asctab.h'`"
  182. then
  183.     echo shar: error transmitting "'asctab.h'" '(should have been 1440 characters)'
  184. fi
  185. fi # end of overwriting check
  186. echo shar: extracting "'glyph.h'" '(1470 characters)'
  187. if test -f 'glyph.h'
  188. then
  189.     echo shar: will not over-write existing file "'glyph.h'"
  190. else
  191. sed 's/^    X//' << \SHAR_EOF > 'glyph.h'
  192.     X/*
  193.     X * $Header: glyph.h,v 1.1 85/08/15 15:07:31 ron Exp $
  194.     X */
  195.     X
  196.     X/*
  197.     X * $Log:    glyph.h,v $
  198.     X * Revision 1.1  85/08/15  15:07:31  ron
  199.     X * Initial revision
  200.     X * 
  201.     X * 
  202.     X */
  203.     X
  204.     Xstruct f_header
  205.     X  {
  206.     X    short        f_magic ;
  207.     X        /*
  208.     X         * Should be 0436 - for vfont. rasti10 uses
  209.     X         * just 0 (i think)
  210.     X         */
  211.     X    unsigned short    f_size ;
  212.     X        /*
  213.     X         * Total size of raster section
  214.     X         * of the font file.
  215.     X         */
  216.     X        /*
  217.     X         * the following are used for vfont, but seem to
  218.     X         * be consistently 0 for rasti10. this gives us
  219.     X         * a way to distinguish between them.
  220.     X         */
  221.     X    short        f_maxx ;    /* Largest x of character */
  222.     X    short        f_maxy ;    /* Largest y of character */
  223.     X    short        f_xtnd ;    /* Largest extender */
  224.     X  } ;
  225.     X
  226.     Xstruct c_param
  227.     X  {
  228.     X    unsigned short    c_addr ;
  229.     X        /*
  230.     X         * Offset in file where character
  231.     X         * is located. doesn't include the
  232.     X         * size of the c_param and f_header
  233.     X         * structures - see F_OFFSET below
  234.     X         */
  235.     X    short        c_size ;    /* Size in bytes of character    */
  236.     X    char        c_up ;
  237.     X    char        c_down ;
  238.     X        /*
  239.     X         * c_up + c_down = heigth of raster in
  240.     X         * font file, in rows, for vfont. rasti10 wants
  241.     X         * c_up + c_down + 1.
  242.     X         */
  243.     X    char        c_left ;
  244.     X    char        c_right ;
  245.     X        /*
  246.     X         * c_right + c_left = width of raster in
  247.     X         * font file, in bits (dots), for vfont. rasti10 wants
  248.     X         * c_right + c_left + 1.
  249.     X         */
  250.     X    char        c_width ;
  251.     X        /*
  252.     X         * Width, including space required
  253.     X         * to print character.
  254.     X         * rasti10 may not use this. be careful.
  255.     X         */
  256.     X  } ;
  257.     X
  258.     X
  259.     X#define    F_OFFSET    ((long)(sizeof(struct f_header)+ \
  260.     X                256*sizeof(struct c_param)))
  261. SHAR_EOF
  262. if test 1470 -ne "`wc -c < 'glyph.h'`"
  263. then
  264.     echo shar: error transmitting "'glyph.h'" '(should have been 1470 characters)'
  265. fi
  266. fi # end of overwriting check
  267. echo shar: extracting "'spectab.h'" '(4258 characters)'
  268. if test -f 'spectab.h'
  269. then
  270.     echo shar: will not over-write existing file "'spectab.h'"
  271. else
  272. sed 's/^    X//' << \SHAR_EOF > 'spectab.h'
  273.     X/*
  274.     X * $Header: spectab.h,v 1.1 85/08/15 15:07:15 ron Exp $
  275.     X */
  276.     X
  277.     X/*
  278.     X * spectab.h - Copyright (c) 1985 by Ron Saad
  279.     X *
  280.     X * This code may be freely distributed in source
  281.     X * for non commercial purposes.
  282.     X * Please keep this notice intact.
  283.     X */
  284.     X
  285.     X/*
  286.     X * $Log:    spectab.h,v $
  287.     X * Revision 1.1  85/08/15  15:07:15  ron
  288.     X * Initial revision
  289.     X * 
  290.     X * 
  291.     X */
  292.     X
  293.     Xchar *spectab[] ={
  294.     X    /*
  295.     X     * these are the names of the characters
  296.     X     *  on the Special font, in same order as
  297.     X     *  described in the 'Berkeley Font Catalog'.
  298.     X     *  The index of the name is supposed to give
  299.     X     *  the position of that character in the
  300.     X     *  character description table, from which
  301.     X     *  we directly grab a pointer to the binary
  302.     X     *  bit map starting position.
  303.     X     */
  304.     X    "",    /* space */
  305.     X    "if",    /* infinity */
  306.     X    "ip",    /* improper superset */
  307.     X    "pt",    /* proportional to */
  308.     X    "rh",    /* right hand */
  309.     X    "cu",    /* cup (union) */
  310.     X    "rn",    /* root en extender */
  311.     X    "bs",    /* bell sign - seems to have disappeared from
  312.     X        the troff output according to the DWB manual */
  313.     X    "+-",    /* plus-minus */
  314.     X    "<=",    /* <= */
  315.     X    ">=",    /* >= */
  316.     X    "sr",    /* square root */
  317.     X    "ts",    /* terminal sigma */
  318.     X    "is",    /* integral sign */
  319.     X    "sl",    /* slash */
  320.     X    "bv",    /* bold vertical */
  321.     X    "lf",    /* left floor (big bracket) */
  322.     X    "rf",    /* right floor (big bracket) */
  323.     X    "lc",    /* left ceiling (big bracket) */
  324.     X    "rc",    /* right ceiling (big bracket) */
  325.     X    "lt",    /* left top (big brace) */
  326.     X    "lb",    /* left bottom (big brace) */
  327.     X    "rt",    /* right top (big brace) */
  328.     X    "rb",    /* right bottom (big brace) */
  329.     X    "lk",    /* left center (big brace) */
  330.     X    "rk",    /* right center (big brace) */
  331.     X    "sb",    /* subset of */
  332.     X    "sp",    /* superset of */
  333.     X    "ca",    /* cap (intersection) */
  334.     X    "no",    /* not */
  335.     X    "lh",    /* left hand */
  336.     X    "mo",    /* member of */
  337.     X    "",
  338.     X    "",
  339.     X    "\"",    /* - not in DWB manual */
  340.     X    "#",    /* - not in DWB manual */
  341.     X    "",
  342.     X    "",
  343.     X    "",
  344.     X    "\\'",    /* name not in Berekeley, but looks like
  345.     X        an accute accent. will never be used since
  346.     X        "aa" occurs in asctab first. */
  347.     X    "gr",    /* gradient */
  348.     X    "",
  349.     X    "mu",    /* multiply */
  350.     X    "pl",    /* math plus */
  351.     X    "",
  352.     X    "mi",    /* math minus */
  353.     X    "",
  354.     X    "di",    /* divide */
  355.     X    "==",    /* identically equal */
  356.     X    "~=",    /* approximately equal */
  357.     X    "ap",    /* approximates */
  358.     X    "!=",    /* not equal */
  359.     X    "<-",    /* left arrow */
  360.     X    "->",    /* right arrow */
  361.     X    "ua",    /* up arrow */
  362.     X    "da",    /* down arrow */
  363.     X    "sc",    /* section */
  364.     X    "**",    /* math star */
  365.     X    "",
  366.     X    "",
  367.     X    "",    /* really a '<' */
  368.     X    "eq",    /* name not in Berekeley */
  369.     X    "",    /* really a '>' */
  370.     X    "",
  371.     X    "",    /* looks like the '@' */
  372.     X    "*A",    /* Alpha (mapped into English on font pos 1) */
  373.     X    "*B",    /* Betta (mapped into English on font pos 1) */
  374.     X    "*G",    /* Gamma */
  375.     X    "*D",    /* Delta */
  376.     X    "*E",    /* Epsilon (mapped into English on font pos 1) */
  377.     X    "*Z",    /* Zetta (mapped into English on font pos 1) */
  378.     X    "*Y",    /* Etta (mapped into English on font pos 1) */
  379.     X    "*H",    /* Theta */
  380.     X    "*I",    /* Iotta (mapped into English on font pos 1) */
  381.     X    "*K",    /* Kappa (mapped into English on font pos 1) */
  382.     X    "*L",    /* Lambda */
  383.     X    "*M",    /* Mu (mapped into English on font pos 1) */
  384.     X    "*N",    /* Nu (mapped into English on font pos 1) */
  385.     X    "*C",    /* Xi */
  386.     X    "*O",    /* Omicron (mapped into English on font pos 1) */
  387.     X    "*P",    /* Pi */
  388.     X    "*R",    /* Rho (mapped into English on font pos 1) */
  389.     X    "*S",    /* Sigma */
  390.     X    "*T",    /* Tau (mapped into English on font pos 1) */
  391.     X    "*U",    /* Upsilon */
  392.     X    "*F",    /* Phi */
  393.     X    "*X",    /* Chi (mapped into English on font pos 1) */
  394.     X    "*Q",    /* Psi */
  395.     X    "*W",    /* Omega */
  396.     X    "dd",    /* double dagger - not in DWB manual */
  397.     X    "br",    /* box vertical rule */
  398.     X    "ib",    /* improper subset */
  399.     X    "\\e",    /* backslash - not in DWB manual */
  400.     X    "ci",    /* circle */
  401.     X    "",        /* really a '^' */
  402.     X    /* "ul",    /* underrule - name not in Berkeley */
  403.     X    "ru",    /* try a rule - name not in Berkeley */
  404.     X    "\\`",    /* grave accent ("ga" listed in asctab) */
  405.     X    "*a",    /* alpha */
  406.     X    "*b",    /* betta */
  407.     X    "*g",    /* gamma */
  408.     X    "*d",    /* delta */
  409.     X    "*e",    /* epsilon */
  410.     X    "*z",    /* zetta */
  411.     X    "*y",    /* etta */
  412.     X    "*h",    /* theta */
  413.     X    "*i",    /* iotta */
  414.     X    "*k",    /* kappa */
  415.     X    "*l",    /* lambda */
  416.     X    "*m",    /* mu */
  417.     X    "*n",    /* nu */
  418.     X    "*c",    /* xi */
  419.     X    "*o",    /* omicron */
  420.     X    "*p",    /* pi */
  421.     X    "*r",    /* rho */
  422.     X    "*s",    /* sigma */
  423.     X    "*t",    /* tau */
  424.     X    "*u",    /* upsilon */
  425.     X    "*f",    /* phi */
  426.     X    "*x",    /* chi */
  427.     X    "*q",    /* psi */
  428.     X    "*w",    /* omega */
  429.     X    "pd",    /* partial derivative */
  430.     X    "es",    /* empty set */
  431.     X    "",    /* really a '{' */
  432.     X    "or",    /* or */
  433.     X    "",    /* really a '}' */
  434.     X    "",    /* really a '~' */
  435.     X    ""
  436.     X};
  437.     X
  438. SHAR_EOF
  439. if test 4258 -ne "`wc -c < 'spectab.h'`"
  440. then
  441.     echo shar: error transmitting "'spectab.h'" '(should have been 4258 characters)'
  442. fi
  443. fi # end of overwriting check
  444. #    End of shell archive
  445. exit 0
  446.  
  447.